import 'package:domain/model/banner_domain_model.dart';

class HomeTabUIState {
  final bool isLoading;
  final List<BannerDomainModel> banners;

  const HomeTabUIState({required this.isLoading, required this.banners});

  static const initial = HomeTabUIState(isLoading: true, banners: []);

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is HomeTabUIState &&
          runtimeType == other.runtimeType &&
          isLoading == other.isLoading &&
          banners == other.banners);

  @override
  int get hashCode => isLoading.hashCode ^ banners.hashCode;

  @override
  String toString() {
    return 'HomeTabUIState{'
        ' isLoading: $isLoading,'
        ' banners: $banners,'
        '}';
  }

  HomeTabUIState copyWith({bool? isLoading, List<BannerDomainModel>? banners}) {
    return HomeTabUIState(
      isLoading: isLoading ?? this.isLoading,
      banners: banners ?? this.banners,
    );
  }

  Map<String, dynamic> toMap() {
    return {'isLoading': isLoading, 'banners': banners};
  }

  factory HomeTabUIState.fromMap(Map<String, dynamic> map) {
    return HomeTabUIState(
      isLoading: map['isLoading'] as bool,
      banners: map['banners'] as List<BannerDomainModel>,
    );
  }
}

////
sealed class HomeTabEvent {}

class InitEvent extends HomeTabEvent {}

class TestSendEvent extends HomeTabEvent {
  final String param;

  TestSendEvent({required this.param});
}

class TestLoadingEvent extends HomeTabEvent {
}

class NewEvent extends HomeTabEvent {
  final String value;

  NewEvent({required this.value});
}

////
sealed class HomeTabSideEffect {}

class InitFinishedEffect extends HomeTabSideEffect {
  final String param;

  InitFinishedEffect({required this.param});
}

class ShowLoadingEffect extends HomeTabSideEffect {}

class HideLoadingEffect extends HomeTabSideEffect {}
